// import './mock'
import Vue from 'vue'
import App from './App.vue'
import './style/global.less'
import router from './router'
import showMessage from '@/utils/showMessage'
import vLoading from '@/directives/loading'
// import '@/mock'
import {
    eventBus
} from '@/utils'
import vLazy from "@/directives/lazy"
import store from "@/store"
import {
    getSetting
} from '@/api/setting'

Vue.prototype.$showMessage = showMessage;
Vue.prototype.$eventBus = eventBus;

Vue.directive('lazy', vLazy);
Vue.directive('loading', vLoading);
new Vue({
    router,
    store,
    render: h => h(App),
}).$mount('#app')

window.store = store;

// 简单测试一下
// import * as blogApi from '@/api/blog'
// blogApi.getBlogs(2, 15, -1).then(data => console.log("博客",data));
// blogApi.getBlogTypes().then(data => console.log('博客分类',data));
// blogApi.getBlog('jgaoeg').then(res => console.log(res))

// blogApi.postComment({
//     nickname: "昵称",
// 	content: "评论内容，纯文本",
// 	blogId: "2283"
//     }
// ).then(res => console.log(res))

// blogApi.getComments('123123').then(res => console.log(res))


//测试事件总线  
// import eventBus from "./eventBus"
// function handle1(data){
//     console.log("handle1", data);
// }
// console.log(Math.abs(123))
// function handle2(data){
//     console.log("handle2", data);
// }
// eventBus.$on("event1", handle1);
// eventBus.$on("event1", handle2)
// eventBus.$on("event2", handle1)
// window.eventBus = eventBus;
// window.handle1 = handle1;
// window.handle2 = handle2;